Mise à jour du titre (imparfait)
This commit is contained in:
1 parent
345129c7bf
commit
509a3b14c8
14 files changed
+451
-18
No files matched your search
@@ -1,24 +1,21 @@
|
||||
<script lang="ts">
|
||||
import {autofocus} from "$lib/ui/autofocus"
|
||||
import {onMount, tick } from "svelte"
|
||||
import {onMount, tick, untrack } from "svelte"
|
||||
import {page} from "$app/state"
|
||||
import {chatApi} from "$lib/api/endpoints/chat"
|
||||
import type { PageProps } from './$types';
|
||||
import type { Message, ChatWithMessages } from "$lib/types/api"
|
||||
import type { Message } from "$lib/types/api"
|
||||
import SvelteMarkdown from '@humanspeak/svelte-markdown'
|
||||
|
||||
let prompt = $state("")
|
||||
let { data }: PageProps = $props();
|
||||
let messages = $state([] as Message[])
|
||||
let messages = $state(untrack(()=>data.chatWithMessage.messages))
|
||||
let waiting = $state(false)
|
||||
|
||||
onMount(async ()=>{
|
||||
if (page.state.prompt) {
|
||||
console.log(page.state.prompt)
|
||||
await sendRequest(page.state.prompt)
|
||||
} else {
|
||||
let chatWithMessage : ChatWithMessages = await chatApi.getChat(data.spaceId, data.chatId)
|
||||
messages = chatWithMessage.messages
|
||||
}
|
||||
await tick()
|
||||
historyDiv.scrollTop = historyDiv.scrollHeight;
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import type { PageLoad } from "./$types";
|
||||
import { chatApi } from "$lib/api/endpoints/chat"
|
||||
|
||||
export const load: PageLoad = ({params}) => {
|
||||
export const load: PageLoad = async ({ params }) => {
|
||||
const chatWithMessage = await chatApi.getChat(params.space, params.conversation)
|
||||
return {
|
||||
title: 'Nouvelle conversation',
|
||||
title: chatWithMessage.chat.title,
|
||||
spaceId: params.space,
|
||||
chatId: params.conversation,
|
||||
chatWithMessage: chatWithMessage,
|
||||
};
|
||||
}
|
||||
@@ -21,11 +21,11 @@ let {
|
||||
|
||||
let tool = $state(untrack(()=>item))
|
||||
let toolParams = $state([] as ToolParam[])
|
||||
let paramValues = new SvelteMap<string, string>();
|
||||
let paramValues = new SvelteMap<string, unknown>();
|
||||
|
||||
onMount(async () => {
|
||||
toolParams = await toolApi.getToolParams(item.teamId, item.id)
|
||||
paramValues = new SvelteMap<string, string>(Object.entries(JSON.parse(item.configuration)));
|
||||
paramValues = new SvelteMap<string, unknown>(Object.entries(JSON.parse(item.configuration)));
|
||||
})
|
||||
|
||||
const autofocus = (node: HTMLElement) => {
|
||||
@@ -79,12 +79,29 @@ const handleCancel = (e: Event) => {
|
||||
|
||||
<div class="formelement">
|
||||
<label for={param.name}>{param.name}</label>
|
||||
<input
|
||||
id={param.name}
|
||||
bind:value={() => paramValues.get(param.name) ?? '', (v) => paramValues.set(param.name, v)}
|
||||
class="textinput"
|
||||
placeholder={param.description}
|
||||
/>
|
||||
{#if param.type == "bool"}
|
||||
<input
|
||||
id="enabled"
|
||||
type="checkbox"
|
||||
bind:checked={() => paramValues.get(param.name) as boolean ?? '', (v) => paramValues.set(param.name, v)}
|
||||
class="checkboxinput"
|
||||
/>
|
||||
{:else if param.type=="int"}
|
||||
<input
|
||||
id={param.name}
|
||||
type="number"
|
||||
bind:value={() => paramValues.get(param.name) ?? '', (v) => paramValues.set(param.name, v)}
|
||||
class="textinput"
|
||||
placeholder={param.description}
|
||||
/>
|
||||
{:else}
|
||||
<input
|
||||
id={param.name}
|
||||
bind:value={() => paramValues.get(param.name) ?? '', (v) => paramValues.set(param.name, v)}
|
||||
class="textinput"
|
||||
placeholder={param.description}
|
||||
/>
|
||||
{/if}
|
||||
<FormError key="baseUrl" errors={errors} />
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user