mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-08 03:48:14 +02:00
squash
This commit is contained in:
parent
49397e8a86
commit
ff6a15b5af
@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
Revision ID: 4e8e7ae58189
|
||||
Revises: f7e58d357687
|
||||
Revises: 5c7fdadae813
|
||||
Create Date: 2024-09-09 10:07:58.008838
|
||||
|
||||
"""
|
||||
@ -12,7 +12,7 @@ import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "4e8e7ae58189"
|
||||
down_revision = "f7e58d357687"
|
||||
down_revision = "5c7fdadae813"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
@ -634,6 +634,13 @@ def stream_chat_message_objects(
|
||||
)
|
||||
|
||||
# LLM prompt building, response capturing, etc.
|
||||
print("IS CONNECTED FUNCTION IS", is_connected)
|
||||
logger.info(f"Is connected function: {is_connected}")
|
||||
if is_connected:
|
||||
logger.debug(f"Is connected function type: {type(is_connected)}")
|
||||
logger.debug(f"Is connected function callable: {callable(is_connected)}")
|
||||
else:
|
||||
logger.warning("Is connected function is None or falsy")
|
||||
answer = Answer(
|
||||
is_connected=is_connected,
|
||||
question=final_msg.message,
|
||||
@ -744,7 +751,6 @@ def stream_chat_message_objects(
|
||||
response=custom_tool_response.tool_result,
|
||||
tool_name=custom_tool_response.tool_name,
|
||||
)
|
||||
|
||||
elif isinstance(packet, StreamStopInfo):
|
||||
if packet.stop_reason is not StreamStopReason.NEW_RESPONSE:
|
||||
break
|
||||
@ -815,10 +821,11 @@ def stream_chat_message_objects(
|
||||
db_session=db_session,
|
||||
commit=False,
|
||||
)
|
||||
else:
|
||||
if isinstance(packet, ToolCallFinalResult):
|
||||
tool_result = packet
|
||||
yield cast(ChatPacket, packet)
|
||||
|
||||
elif isinstance(packet, ToolCallFinalResult):
|
||||
tool_result = packet
|
||||
yield cast(ChatPacket, packet)
|
||||
logger.debug("Reached end of stream")
|
||||
except Exception as e:
|
||||
error_msg = str(e)
|
||||
|
@ -135,7 +135,7 @@ POSTGRES_PASSWORD = urllib.parse.quote_plus(
|
||||
os.environ.get("POSTGRES_PASSWORD") or "password"
|
||||
)
|
||||
POSTGRES_HOST = os.environ.get("POSTGRES_HOST") or "localhost"
|
||||
POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5432"
|
||||
POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5433"
|
||||
POSTGRES_DB = os.environ.get("POSTGRES_DB") or "postgres"
|
||||
|
||||
# defaults to False
|
||||
|
@ -249,8 +249,12 @@ class Answer:
|
||||
tool_call_chunk += message # type: ignore
|
||||
else:
|
||||
if message.content:
|
||||
print(message)
|
||||
|
||||
if self.is_cancelled:
|
||||
return
|
||||
else:
|
||||
print("not canncelled")
|
||||
yield cast(str, message.content)
|
||||
if (
|
||||
message.additional_kwargs.get("usage_metadata", {}).get(
|
||||
@ -463,11 +467,13 @@ class Answer:
|
||||
self.question, self.prompt_config, self.latest_query_files
|
||||
)
|
||||
)
|
||||
print("I am now yielding from here")
|
||||
prompt = prompt_builder.build()
|
||||
yield from self._process_llm_stream(
|
||||
prompt=prompt,
|
||||
tools=None,
|
||||
)
|
||||
print("yielding complete")
|
||||
return
|
||||
|
||||
tool, tool_args = chosen_tool_and_args
|
||||
@ -552,6 +558,7 @@ class Answer:
|
||||
final_context_docs: list[LlmDoc] | None = None
|
||||
|
||||
for message in stream:
|
||||
print(message)
|
||||
if isinstance(message, ToolCallKickoff) or isinstance(
|
||||
message, ToolCallFinalResult
|
||||
):
|
||||
|
@ -279,16 +279,23 @@ async def is_disconnected(request: Request) -> Callable[[], bool]:
|
||||
main_loop = asyncio.get_event_loop()
|
||||
|
||||
def is_disconnected_sync() -> bool:
|
||||
logger.info("Checking if client is disconnected")
|
||||
future = asyncio.run_coroutine_threadsafe(request.is_disconnected(), main_loop)
|
||||
try:
|
||||
return not future.result(timeout=0.01)
|
||||
result = not future.result(timeout=0.01)
|
||||
if result:
|
||||
logger.info("Client disconnected")
|
||||
return result
|
||||
except asyncio.TimeoutError:
|
||||
logger.error("Asyncio timed out")
|
||||
logger.error("Asyncio timed out while checking client connection")
|
||||
return True
|
||||
except asyncio.CancelledError:
|
||||
logger.info("Disconnect check was cancelled")
|
||||
return True
|
||||
except Exception as e:
|
||||
error_msg = str(e)
|
||||
logger.critical(
|
||||
f"An unexpected error occured with the disconnect check coroutine: {error_msg}"
|
||||
f"An unexpected error occurred with the disconnect check coroutine: {error_msg}"
|
||||
)
|
||||
return True
|
||||
|
||||
|
@ -21,7 +21,7 @@ CONNECTOR_CLASSIFIER_MODEL_TAG = "1.0.0"
|
||||
INTENT_MODEL_VERSION = "danswer/hybrid-intent-token-classifier"
|
||||
INTENT_MODEL_TAG = "v1.0.3"
|
||||
|
||||
# TOoc all configs
|
||||
# Tool call configs
|
||||
MAX_TOOL_CALLS = 2
|
||||
|
||||
# Bi-Encoder, other details
|
||||
|
@ -292,7 +292,7 @@ services:
|
||||
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
|
||||
ports:
|
||||
- "5432:5432"
|
||||
- "5433:5432"
|
||||
volumes:
|
||||
- db_volume:/var/lib/postgresql/data
|
||||
|
||||
|
@ -302,7 +302,7 @@ services:
|
||||
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
|
||||
ports:
|
||||
- "5432:5432"
|
||||
- "5433:5432"
|
||||
volumes:
|
||||
- db_volume:/var/lib/postgresql/data
|
||||
|
||||
|
@ -154,7 +154,7 @@ services:
|
||||
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
|
||||
ports:
|
||||
- "5432"
|
||||
- "5433"
|
||||
volumes:
|
||||
- db_volume:/var/lib/postgresql/data
|
||||
|
||||
|
@ -13,7 +13,6 @@ import {
|
||||
ImageGenerationDisplay,
|
||||
Message,
|
||||
MessageResponseIDInfo,
|
||||
PreviousAIMessage,
|
||||
RetrievalType,
|
||||
StreamingError,
|
||||
ToolCallMetadata,
|
||||
@ -1253,7 +1252,6 @@ export function ChatPage({
|
||||
dynamicParentMessage === null &&
|
||||
dynamicAssistantMessage === null
|
||||
) {
|
||||
console.log("INITIALizing");
|
||||
dynamicParentMessage = initialDynamicParentMessage;
|
||||
dynamicAssistantMessage = initialDynamicAssistantMessage;
|
||||
dynamicParentMessage.childrenMessageIds = [
|
||||
@ -2469,14 +2467,6 @@ export function ChatPage({
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
<Button
|
||||
onClick={() => {
|
||||
console.log(completeMessageDetail);
|
||||
console.log(messageHistory);
|
||||
}}
|
||||
>
|
||||
CLICK EM
|
||||
</Button>
|
||||
<ChatInputBar
|
||||
showConfigureAPIKey={() =>
|
||||
setShowApiKeyModal(true)
|
||||
|
@ -76,24 +76,6 @@ export interface SearchSession {
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface PreviousAIMessage {
|
||||
messageId?: number;
|
||||
message?: string;
|
||||
type?: "assistant";
|
||||
retrievalType?: RetrievalType;
|
||||
query?: string | null;
|
||||
documents?: DanswerDocument[] | null;
|
||||
citations?: CitationMap;
|
||||
files?: FileDescriptor[];
|
||||
toolCall?: ToolCallMetadata | null;
|
||||
|
||||
// for rebuilding the message tree
|
||||
parentMessageId?: number | null;
|
||||
childrenMessageIds?: number[];
|
||||
latestChildMessageId?: number | null;
|
||||
alternateAssistantID?: number | null;
|
||||
}
|
||||
|
||||
export interface Message {
|
||||
messageId: number;
|
||||
message: string;
|
||||
|
@ -777,7 +777,7 @@ export const HumanMessage = ({
|
||||
outline-none
|
||||
placeholder-gray-400
|
||||
resize-none
|
||||
pl-4crea
|
||||
pl-4
|
||||
overflow-y-auto
|
||||
pr-12
|
||||
py-4`}
|
||||
|
Loading…
x
Reference in New Issue
Block a user